//
//  XSquareForwardCell.swift
//  WeiBoReDo
//
//  Created by 放学跟鸽走 on 2017/4/16.
//  Copyright © 2017年 放学跟鸽走. All rights reserved.
//

import UIKit

/// 转发鸽友圈的cell
class XSquareForwardCell: XSquareBaseCell {

  
    /// 添加
    override func addViewToCell(){
        addSubview(topView)
        retweetBack.backgroundColor = UIColor.cz_color(withHex: 0xE3E3E3)
        addSubview(retweetBack)
        addSubview(statusLabel)
        addSubview(retweetedLabel)
        addSubview(bottomView)
        addSubview(picView)
        
        for v in subviews{
            v.translatesAutoresizingMaskIntoConstraints = false
        }
    }
    // 原创微博：顶部分隔视图(12) + 间距(12) + 图像的高度(34) + 间距(12) + 正文高度(需要计算) + 配图视图高度(计算) + 间距(12) ＋ 底部视图高度(35)
    // 被转发微博：顶部分隔视图(12) + 间距(12) + 图像的高度(34) + 间距(12) + 正文高度(需要计算) + 间距(12)+间距(12)+转发文本高度(需要计算) + 配图视图高度(计算) + 间距(12) ＋ 底部视图高度(35)
    override func setupViewInCell(){
        
        topView.snp.makeConstraints { (make) in
            make.top.equalTo(snp.top)
            make.left.equalTo(snp.left)
            make.right.equalTo(snp.right)
            make.height.equalTo(12+12+34+12)
        }
        
        //        topView.backgroundColor = UIColor.red
        //正文
        statusLabel.snp.makeConstraints { (make) in
            make.left.equalTo(snp.left).offset(StatusCellMargin)
            make.top.equalTo(topView.snp.bottom)
            make.width.equalTo(UIScreen.cz_screenWidth()-2*StatusCellMargin
            )
            
        }
        //转发背景
        retweetBack.snp.makeConstraints { (make) in
            make.top.equalTo(statusLabel.snp.bottom).offset(StatusCellMargin)
            make.left.right.equalTo(self)
            make.bottom.equalTo(bottomView)
        }
        
        //转发文字
        retweetedLabel.snp.makeConstraints { (make) in
            make.top.equalTo(retweetBack.snp.top).offset(StatusCellMargin)
            make.left.equalTo(statusLabel.snp.left)
            make.width.equalTo(statusLabel.snp.width)
        }
        
        //配图
        picView.snp.makeConstraints { (make) in
            make.left.equalTo(snp.left).offset(XStatusPictureViewOutterMargin)
            make.right.equalTo(snp.right).offset(XStatusPictureViewOutterMargin)
            make.top.equalTo(retweetedLabel.snp.bottom)
            make.height.equalTo(90)
            make.bottom.lessThanOrEqualTo(bottomView.snp.top).offset(XStatusPictureViewOutterMargin)
        }
        
        //        statusLabel.backgroundColor = UIColor.green
        
        //底部
        bottomView.snp.makeConstraints { (make) in
            make.left.equalTo(snp.left)
            make.right.equalTo(snp.right)
            make.bottom.equalTo(snp.bottom)
            make.height.equalTo(35)
        }
        
    }
}

